﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace SpaceShooter
{
    public class GameField
    {
        public Vector3 PlayerPosition { get; set; }
        public Vector3 PlayerDirection { get; set; }
        public float LeftEdge { get; set; }
        public float RightEdge { get; set; }
        public float FrontEdge { get; set; }
        public float BackEdge { get; set; }
        public float TopEdge { get; set; }
        public float BottomEdge { get; set; }

        public bool IsInside(Vector3 pos)
        {
            if (pos.X > this.LeftEdge && pos.X < this.RightEdge &&
                pos.Y > this.BottomEdge && pos.Y < this.TopEdge &&
                pos.Z > this.FrontEdge && pos.Z < this.BackEdge)
                return true;
            else
                 return false;
        }

        public Vector3 Restrict(Vector3 pos)
        {
            if (pos.X < this.LeftEdge)
                pos.X = this.LeftEdge;

            if (pos.X > this.RightEdge)
                pos.X = this.RightEdge;

            if (pos.Y < this.BottomEdge)
                pos.Y = this.BottomEdge;

            if (pos.Y > this.TopEdge)
                pos.Y = this.TopEdge;

            if (pos.Z < this.FrontEdge)
                pos.Z = this.FrontEdge;

            if (pos.Z > this.BackEdge)
                pos.Z = this.BackEdge;

            return pos;
        }
    }
}
